package com.design.cjm.behavioral.Iterator.example1;

/**
 * @Author: Jie Ming Chen
 * @Date: 2019-04-07
 * @Version 1.0
 */
public class ConcreteIterator implements Iterator<Integer> {

    private Integer[] items;
    private int position = 0;

    public ConcreteIterator(Integer[] items) {
        this.items = items;
    }

    @Override
    public Integer next() {
        return items[position++];
    }

    @Override
    public boolean hasNext() {
        return position < items.length;
    }
}
